
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/series/formal.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:29:10 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Formal Power Series &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../../live.sympy.org/static/live-sphinx.js"></script>
    <script async="async" src="../../../../cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest8331.js?config=TeX-AMS_HTML-full"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["\\(", "\\)"]], "displayMath": [["\\[", "\\]"]]}})</script>
    
    <link rel="shortcut icon" href="../../_static/sympy-notailtext-favicon.ico"/>
    <link href="formal.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Limits of Sequences" href="limitseq.html" />
    <link rel="prev" title="Fourier Series" href="fourier.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="limitseq.html" title="Limits of Sequences"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="fourier.html" title="Fourier Series"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" accesskey="U">Series</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Formal Power Series</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="formal-power-series">
<h1>Formal Power Series<a class="headerlink" href="#formal-power-series" title="Permalink to this headline">¶</a></h1>
<p>Methods for computing and manipulating Formal Power Series.</p>
<dl class="py class">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeries">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">FormalPowerSeries</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L974-L1495"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.FormalPowerSeries" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents Formal Power Series of a function.</p>
<p class="rubric">Explanation</p>
<p>No computation is performed. This class should only to be used to represent
a series. No checks are performed.</p>
<p>For computing a series use <a class="reference internal" href="#sympy.series.formal.fps" title="sympy.series.formal.fps"><code class="xref py py-func docutils literal notranslate"><span class="pre">fps()</span></code></a>.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.series.formal.fps" title="sympy.series.formal.fps"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.fps</span></code></a></p>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeries.coeff_bell">
<span class="sig-name descname"><span class="pre">coeff_bell</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L1268-L1297"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.FormalPowerSeries.coeff_bell" title="Permalink to this definition">¶</a></dt>
<dd><p>self.coeff_bell(n) returns a sequence of Bell polynomials of the second kind.
Note that <code class="docutils literal notranslate"><span class="pre">n</span></code> should be a integer.</p>
<p>The second kind of Bell polynomials (are sometimes called “partial” Bell
polynomials or incomplete Bell polynomials) are defined as</p>
<div class="math notranslate nohighlight">
\[B_{n,k}(x_1, x_2,\dotsc x_{n-k+1}) =
    \sum_{j_1+j_2+j_2+\dotsb=k \atop j_1+2j_2+3j_2+\dotsb=n}
    \frac{n!}{j_1!j_2!\dotsb j_{n-k+1}!}
    \left(\frac{x_1}{1!} \right)^{j_1}
    \left(\frac{x_2}{2!} \right)^{j_2} \dotsb
    \left(\frac{x_{n-k+1}}{(n-k+1)!} \right) ^{j_{n-k+1}}.\]</div>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">bell(n,</span> <span class="pre">k,</span> <span class="pre">(x1,</span> <span class="pre">x2,</span> <span class="pre">...))</span></code> gives Bell polynomials of the second kind,
<span class="math notranslate nohighlight">\(B_{n,k}(x_1, x_2, \dotsc, x_{n-k+1})\)</span>.</p></li>
</ul>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../functions/combinatorial.html#sympy.functions.combinatorial.numbers.bell" title="sympy.functions.combinatorial.numbers.bell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.functions.combinatorial.numbers.bell</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeries.compose">
<span class="sig-name descname"><span class="pre">compose</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">other</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">6</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L1299-L1371"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.FormalPowerSeries.compose" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the truncated terms of the formal power series of the composed function,
up to specified <code class="docutils literal notranslate"><span class="pre">n</span></code>.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>n</strong> : Number, optional</p>
<blockquote>
<div><p>Specifies the order of the term up to which the polynomial should
be truncated.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>If <code class="docutils literal notranslate"><span class="pre">f</span></code> and <code class="docutils literal notranslate"><span class="pre">g</span></code> are two formal power series of two different functions,
then the coefficient sequence <code class="docutils literal notranslate"><span class="pre">ak</span></code> of the composed formal power series <span class="math notranslate nohighlight">\(fp\)</span>
will be as follows.</p>
<div class="math notranslate nohighlight">
\[\sum\limits_{k=0}^{n} b_k B_{n,k}(x_1, x_2, \dotsc, x_{n-k+1})\]</div>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">fps</span><span class="p">,</span> <span class="n">sin</span><span class="p">,</span> <span class="n">exp</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f1</span> <span class="o">=</span> <span class="n">fps</span><span class="p">(</span><span class="n">exp</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f2</span> <span class="o">=</span> <span class="n">fps</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">f1</span><span class="o">.</span><span class="n">compose</span><span class="p">(</span><span class="n">f2</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">truncate</span><span class="p">()</span>
<span class="go">1 + x + x**2/2 - x**4/8 - x**5/15 + O(x**6)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">f1</span><span class="o">.</span><span class="n">compose</span><span class="p">(</span><span class="n">f2</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">truncate</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
<span class="go">1 + x + x**2/2 - x**4/8 - x**5/15 - x**6/240 + x**7/90 + O(x**8)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../functions/combinatorial.html#sympy.functions.combinatorial.numbers.bell" title="sympy.functions.combinatorial.numbers.bell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.functions.combinatorial.numbers.bell</span></code></a>, <a class="reference internal" href="#sympy.series.formal.FormalPowerSeriesCompose" title="sympy.series.formal.FormalPowerSeriesCompose"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.FormalPowerSeriesCompose</span></code></a></p>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r675"><span class="brackets"><a class="fn-backref" href="#id1">R675</a></span></dt>
<dd><p>Comtet, Louis: Advanced combinatorics; the art of finite and infinite expansions. Reidel, 1974.</p>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeries.infinite">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">infinite</span></span><a class="headerlink" href="#sympy.series.formal.FormalPowerSeries.infinite" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns an infinite representation of the series</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeries.integrate">
<span class="sig-name descname"><span class="pre">integrate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L1171-L1214"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.FormalPowerSeries.integrate" title="Permalink to this definition">¶</a></dt>
<dd><p>Integrate Formal Power Series.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">fps</span><span class="p">,</span> <span class="n">sin</span><span class="p">,</span> <span class="n">integrate</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span> <span class="o">=</span> <span class="n">fps</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="o">.</span><span class="n">integrate</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">truncate</span><span class="p">()</span>
<span class="go">-1 + x**2/2 - x**4/24 + O(x**6)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">integrate</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
<span class="go">1 - cos(1)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeries.inverse">
<span class="sig-name descname"><span class="pre">inverse</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">6</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L1373-L1429"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.FormalPowerSeries.inverse" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the truncated terms of the inverse of the formal power series,
up to specified <code class="docutils literal notranslate"><span class="pre">n</span></code>.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>n</strong> : Number, optional</p>
<blockquote>
<div><p>Specifies the order of the term up to which the polynomial should
be truncated.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>If <code class="docutils literal notranslate"><span class="pre">f</span></code> and <code class="docutils literal notranslate"><span class="pre">g</span></code> are two formal power series of two different functions,
then the coefficient sequence <code class="docutils literal notranslate"><span class="pre">ak</span></code> of the composed formal power series <code class="docutils literal notranslate"><span class="pre">fp</span></code>
will be as follows.</p>
<div class="math notranslate nohighlight">
\[\sum\limits_{k=0}^{n} (-1)^{k} x_0^{-k-1} B_{n,k}(x_1, x_2, \dotsc, x_{n-k+1})\]</div>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">fps</span><span class="p">,</span> <span class="n">exp</span><span class="p">,</span> <span class="n">cos</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f1</span> <span class="o">=</span> <span class="n">fps</span><span class="p">(</span><span class="n">exp</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f2</span> <span class="o">=</span> <span class="n">fps</span><span class="p">(</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">f1</span><span class="o">.</span><span class="n">inverse</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">truncate</span><span class="p">()</span>
<span class="go">1 - x + x**2/2 - x**3/6 + x**4/24 - x**5/120 + O(x**6)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">f2</span><span class="o">.</span><span class="n">inverse</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">truncate</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
<span class="go">1 + x**2/2 + 5*x**4/24 + 61*x**6/720 + O(x**8)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../functions/combinatorial.html#sympy.functions.combinatorial.numbers.bell" title="sympy.functions.combinatorial.numbers.bell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.functions.combinatorial.numbers.bell</span></code></a>, <a class="reference internal" href="#sympy.series.formal.FormalPowerSeriesInverse" title="sympy.series.formal.FormalPowerSeriesInverse"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.FormalPowerSeriesInverse</span></code></a></p>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r676"><span class="brackets"><a class="fn-backref" href="#id2">R676</a></span></dt>
<dd><p>Comtet, Louis: Advanced combinatorics; the art of finite and infinite expansions. Reidel, 1974.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeries.polynomial">
<span class="sig-name descname"><span class="pre">polynomial</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">6</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L1064-L1087"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.FormalPowerSeries.polynomial" title="Permalink to this definition">¶</a></dt>
<dd><p>Truncated series as polynomial.</p>
<p class="rubric">Explanation</p>
<p>Returns series expansion of <code class="docutils literal notranslate"><span class="pre">f</span></code> upto order <code class="docutils literal notranslate"><span class="pre">O(x**n)</span></code>
as a polynomial(without <code class="docutils literal notranslate"><span class="pre">O</span></code> term).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeries.product">
<span class="sig-name descname"><span class="pre">product</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">other</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">6</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L1216-L1266"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.FormalPowerSeries.product" title="Permalink to this definition">¶</a></dt>
<dd><p>Multiplies two Formal Power Series, using discrete convolution and
return the truncated terms upto specified order.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>n</strong> : Number, optional</p>
<blockquote>
<div><p>Specifies the order of the term up to which the polynomial should
be truncated.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">fps</span><span class="p">,</span> <span class="n">sin</span><span class="p">,</span> <span class="n">exp</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f1</span> <span class="o">=</span> <span class="n">fps</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f2</span> <span class="o">=</span> <span class="n">fps</span><span class="p">(</span><span class="n">exp</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">f1</span><span class="o">.</span><span class="n">product</span><span class="p">(</span><span class="n">f2</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">truncate</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
<span class="go">x + x**2 + x**3/3 + O(x**4)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../discrete.html#module-sympy.discrete.convolutions" title="sympy.discrete.convolutions"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.discrete.convolutions</span></code></a>, <a class="reference internal" href="#sympy.series.formal.FormalPowerSeriesProduct" title="sympy.series.formal.FormalPowerSeriesProduct"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.FormalPowerSeriesProduct</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeries.truncate">
<span class="sig-name descname"><span class="pre">truncate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">6</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L1089-L1109"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.FormalPowerSeries.truncate" title="Permalink to this definition">¶</a></dt>
<dd><p>Truncated series.</p>
<p class="rubric">Explanation</p>
<p>Returns truncated series expansion of f upto
order <code class="docutils literal notranslate"><span class="pre">O(x**n)</span></code>.</p>
<p>If n is <code class="docutils literal notranslate"><span class="pre">None</span></code>, returns an infinite iterator.</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.series.formal.fps">
<span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">fps</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">f</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x0</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dir</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">hyper</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">order</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rational</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">full</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L1787-L1869"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.fps" title="Permalink to this definition">¶</a></dt>
<dd><p>Generates Formal Power Series of <code class="docutils literal notranslate"><span class="pre">f</span></code>.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>x</strong> : Symbol, optional</p>
<blockquote>
<div><p>If x is None and <code class="docutils literal notranslate"><span class="pre">f</span></code> is univariate, the univariate symbols will be
supplied, otherwise an error will be raised.</p>
</div></blockquote>
<p><strong>x0</strong> : number, optional</p>
<blockquote>
<div><p>Point to perform series expansion about. Default is 0.</p>
</div></blockquote>
<p><strong>dir</strong> : {1, -1, ‘+’, ‘-‘}, optional</p>
<blockquote>
<div><p>If dir is 1 or ‘+’ the series is calculated from the right and
for -1 or ‘-’ the series is calculated from the left. For smooth
functions this flag will not alter the results. Default is 1.</p>
</div></blockquote>
<p><strong>hyper</strong> : {True, False}, optional</p>
<blockquote>
<div><p>Set hyper to False to skip the hypergeometric algorithm.
By default it is set to False.</p>
</div></blockquote>
<p><strong>order</strong> : int, optional</p>
<blockquote>
<div><p>Order of the derivative of <code class="docutils literal notranslate"><span class="pre">f</span></code>, Default is 4.</p>
</div></blockquote>
<p><strong>rational</strong> : {True, False}, optional</p>
<blockquote>
<div><p>Set rational to False to skip rational algorithm. By default it is set
to True.</p>
</div></blockquote>
<p><strong>full</strong> : {True, False}, optional</p>
<blockquote>
<div><p>Set full to True to increase the range of rational algorithm.
See <a class="reference internal" href="#sympy.series.formal.rational_algorithm" title="sympy.series.formal.rational_algorithm"><code class="xref py py-func docutils literal notranslate"><span class="pre">rational_algorithm()</span></code></a> for details. By default it is set to
False.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>Returns the formal series expansion of <code class="docutils literal notranslate"><span class="pre">f</span></code> around <code class="docutils literal notranslate"><span class="pre">x</span> <span class="pre">=</span> <span class="pre">x0</span></code>
with respect to <code class="docutils literal notranslate"><span class="pre">x</span></code> in the form of a <code class="docutils literal notranslate"><span class="pre">FormalPowerSeries</span></code> object.</p>
<p>Formal Power Series is represented using an explicit formula
computed using different algorithms.</p>
<p>See <a class="reference internal" href="#sympy.series.formal.compute_fps" title="sympy.series.formal.compute_fps"><code class="xref py py-func docutils literal notranslate"><span class="pre">compute_fps()</span></code></a> for the more details regarding the computation
of formula.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">fps</span><span class="p">,</span> <span class="n">ln</span><span class="p">,</span> <span class="n">atan</span><span class="p">,</span> <span class="n">sin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">n</span>
</pre></div>
</div>
<p>Rational Functions</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fps</span><span class="p">(</span><span class="n">ln</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">x</span><span class="p">))</span><span class="o">.</span><span class="n">truncate</span><span class="p">()</span>
<span class="go">x - x**2/2 + x**3/3 - x**4/4 + x**5/5 + O(x**6)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fps</span><span class="p">(</span><span class="n">atan</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">full</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="o">.</span><span class="n">truncate</span><span class="p">()</span>
<span class="go">x - x**3/3 + x**5/5 + O(x**6)</span>
</pre></div>
</div>
<p>Symbolic Functions</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">fps</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="n">n</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="p">),</span> <span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">truncate</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
<span class="go">-x**(n + 6)/6 + x**(n + 2) + O(x**(n + 8))</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.series.formal.FormalPowerSeries" title="sympy.series.formal.FormalPowerSeries"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.FormalPowerSeries</span></code></a>, <a class="reference internal" href="#sympy.series.formal.compute_fps" title="sympy.series.formal.compute_fps"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.compute_fps</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.series.formal.compute_fps">
<span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">compute_fps</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">f</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x0</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dir</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">hyper</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">order</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rational</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">full</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L889-L961"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.compute_fps" title="Permalink to this definition">¶</a></dt>
<dd><p>Computes the formula for Formal Power Series of a function.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>x</strong> : Symbol</p>
<p><strong>x0</strong> : number, optional</p>
<blockquote>
<div><p>Point to perform series expansion about. Default is 0.</p>
</div></blockquote>
<p><strong>dir</strong> : {1, -1, ‘+’, ‘-‘}, optional</p>
<blockquote>
<div><p>If dir is 1 or ‘+’ the series is calculated from the right and
for -1 or ‘-’ the series is calculated from the left. For smooth
functions this flag will not alter the results. Default is 1.</p>
</div></blockquote>
<p><strong>hyper</strong> : {True, False}, optional</p>
<blockquote>
<div><p>Set hyper to False to skip the hypergeometric algorithm.
By default it is set to False.</p>
</div></blockquote>
<p><strong>order</strong> : int, optional</p>
<blockquote>
<div><p>Order of the derivative of <code class="docutils literal notranslate"><span class="pre">f</span></code>, Default is 4.</p>
</div></blockquote>
<p><strong>rational</strong> : {True, False}, optional</p>
<blockquote>
<div><p>Set rational to False to skip rational algorithm. By default it is set
to True.</p>
</div></blockquote>
<p><strong>full</strong> : {True, False}, optional</p>
<blockquote>
<div><p>Set full to True to increase the range of rational algorithm.
See <a class="reference internal" href="#sympy.series.formal.rational_algorithm" title="sympy.series.formal.rational_algorithm"><code class="xref py py-func docutils literal notranslate"><span class="pre">rational_algorithm()</span></code></a> for details. By default it is set to
False.</p>
</div></blockquote>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>ak</strong> : sequence</p>
<blockquote>
<div><p>Sequence of coefficients.</p>
</div></blockquote>
<p><strong>xk</strong> : sequence</p>
<blockquote>
<div><p>Sequence of powers of x.</p>
</div></blockquote>
<p><strong>ind</strong> : Expr</p>
<blockquote>
<div><p>Independent terms.</p>
</div></blockquote>
<p><strong>mul</strong> : Pow</p>
<blockquote>
<div><p>Common terms.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>Tries to compute the formula by applying the following techniques
(in order):</p>
<ul class="simple">
<li><p>rational_algorithm</p></li>
<li><p>Hypergeometric algorithm</p></li>
</ul>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.series.formal.rational_algorithm" title="sympy.series.formal.rational_algorithm"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.rational_algorithm</span></code></a>, <a class="reference internal" href="#sympy.series.formal.hyper_algorithm" title="sympy.series.formal.hyper_algorithm"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.hyper_algorithm</span></code></a></p>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeriesCompose">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">FormalPowerSeriesCompose</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L1619-L1693"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.FormalPowerSeriesCompose" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents the composed formal power series of two functions.</p>
<p class="rubric">Explanation</p>
<p>No computation is performed. Terms are calculated using a term by term logic,
instead of a point by point logic.</p>
<p>There are two differences between a <a class="reference internal" href="#sympy.series.formal.FormalPowerSeries" title="sympy.series.formal.FormalPowerSeries"><code class="xref py py-obj docutils literal notranslate"><span class="pre">FormalPowerSeries</span></code></a> object and a
<a class="reference internal" href="#sympy.series.formal.FormalPowerSeriesCompose" title="sympy.series.formal.FormalPowerSeriesCompose"><code class="xref py py-obj docutils literal notranslate"><span class="pre">FormalPowerSeriesCompose</span></code></a> object. The first argument contains the outer
function and the inner function involved in the omposition. Also, the
coefficient sequence contains the generic sequence which is to be multiplied
by a custom <code class="docutils literal notranslate"><span class="pre">bell_seq</span></code> finite sequence. The finite terms will then be added up to
get the final terms.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.series.formal.FormalPowerSeries" title="sympy.series.formal.FormalPowerSeries"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.FormalPowerSeries</span></code></a>, <a class="reference internal" href="#sympy.series.formal.FiniteFormalPowerSeries" title="sympy.series.formal.FiniteFormalPowerSeries"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.FiniteFormalPowerSeries</span></code></a></p>
</div>
<dl class="py property">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeriesCompose.function">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">function</span></span><a class="headerlink" href="#sympy.series.formal.FormalPowerSeriesCompose.function" title="Permalink to this definition">¶</a></dt>
<dd><p>Function for the composed formal power series.</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeriesInverse">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">FormalPowerSeriesInverse</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L1696-L1784"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.FormalPowerSeriesInverse" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents the Inverse of a formal power series.</p>
<p class="rubric">Explanation</p>
<p>No computation is performed. Terms are calculated using a term by term logic,
instead of a point by point logic.</p>
<p>There is a single difference between a <a class="reference internal" href="#sympy.series.formal.FormalPowerSeries" title="sympy.series.formal.FormalPowerSeries"><code class="xref py py-obj docutils literal notranslate"><span class="pre">FormalPowerSeries</span></code></a> object and a
<a class="reference internal" href="#sympy.series.formal.FormalPowerSeriesInverse" title="sympy.series.formal.FormalPowerSeriesInverse"><code class="xref py py-obj docutils literal notranslate"><span class="pre">FormalPowerSeriesInverse</span></code></a> object. The coefficient sequence contains the
generic sequence which is to be multiplied by a custom <code class="docutils literal notranslate"><span class="pre">bell_seq</span></code> finite sequence.
The finite terms will then be added up to get the final terms.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.series.formal.FormalPowerSeries" title="sympy.series.formal.FormalPowerSeries"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.FormalPowerSeries</span></code></a>, <a class="reference internal" href="#sympy.series.formal.FiniteFormalPowerSeries" title="sympy.series.formal.FiniteFormalPowerSeries"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.FiniteFormalPowerSeries</span></code></a></p>
</div>
<dl class="py property">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeriesInverse.function">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">function</span></span><a class="headerlink" href="#sympy.series.formal.FormalPowerSeriesInverse.function" title="Permalink to this definition">¶</a></dt>
<dd><p>Function for the inverse of a formal power series.</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeriesProduct">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">FormalPowerSeriesProduct</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L1549-L1616"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.FormalPowerSeriesProduct" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents the product of two formal power series of two functions.</p>
<p class="rubric">Explanation</p>
<p>No computation is performed. Terms are calculated using a term by term logic,
instead of a point by point logic.</p>
<p>There are two differences between a <a class="reference internal" href="#sympy.series.formal.FormalPowerSeries" title="sympy.series.formal.FormalPowerSeries"><code class="xref py py-obj docutils literal notranslate"><span class="pre">FormalPowerSeries</span></code></a> object and a
<a class="reference internal" href="#sympy.series.formal.FormalPowerSeriesProduct" title="sympy.series.formal.FormalPowerSeriesProduct"><code class="xref py py-obj docutils literal notranslate"><span class="pre">FormalPowerSeriesProduct</span></code></a> object. The first argument contains the two
functions involved in the product. Also, the coefficient sequence contains
both the coefficient sequence of the formal power series of the involved functions.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.series.formal.FormalPowerSeries" title="sympy.series.formal.FormalPowerSeries"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.FormalPowerSeries</span></code></a>, <a class="reference internal" href="#sympy.series.formal.FiniteFormalPowerSeries" title="sympy.series.formal.FiniteFormalPowerSeries"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.FiniteFormalPowerSeries</span></code></a></p>
</div>
<dl class="py property">
<dt class="sig sig-object py" id="sympy.series.formal.FormalPowerSeriesProduct.function">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">function</span></span><a class="headerlink" href="#sympy.series.formal.FormalPowerSeriesProduct.function" title="Permalink to this definition">¶</a></dt>
<dd><p>Function of the product of two formal power series.</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.series.formal.FiniteFormalPowerSeries">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">FiniteFormalPowerSeries</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L1498-L1546"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.FiniteFormalPowerSeries" title="Permalink to this definition">¶</a></dt>
<dd><p>Base Class for Product, Compose and Inverse classes</p>
</dd></dl>

<section id="rational-algorithm">
<h2>Rational Algorithm<a class="headerlink" href="#rational-algorithm" title="Permalink to this headline">¶</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="sympy.series.formal.rational_independent">
<span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">rational_independent</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">terms</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L168-L199"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.rational_independent" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list of all the rationally independent terms.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">sin</span><span class="p">,</span> <span class="n">cos</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.series.formal</span> <span class="kn">import</span> <span class="n">rational_independent</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">rational_independent</span><span class="p">([</span><span class="n">cos</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)],</span> <span class="n">x</span><span class="p">)</span>
<span class="go">[cos(x), sin(x)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rational_independent</span><span class="p">([</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span> <span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="o">*</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="o">**</span><span class="mi">3</span><span class="p">],</span> <span class="n">x</span><span class="p">)</span>
<span class="go">[x**3 + x**2, x*sin(x) + sin(x)]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.series.formal.rational_algorithm">
<span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">rational_algorithm</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">f</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">k</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">order</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">full</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L30-L165"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.rational_algorithm" title="Permalink to this definition">¶</a></dt>
<dd><p>Rational algorithm for computing
formula of coefficients of Formal Power Series
of a function.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>x</strong> : Symbol</p>
<p><strong>order</strong> : int, optional</p>
<blockquote>
<div><p>Order of the derivative of <code class="docutils literal notranslate"><span class="pre">f</span></code>, Default is 4.</p>
</div></blockquote>
<p><strong>full</strong> : bool</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>formula</strong> : Expr</p>
<p><strong>ind</strong> : Expr</p>
<blockquote>
<div><p>Independent terms.</p>
</div></blockquote>
<p><strong>order</strong> : int</p>
<p><strong>full</strong> : bool</p>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>Applicable when f(x) or some derivative of f(x)
is a rational function in x.</p>
<p><a class="reference internal" href="#sympy.series.formal.rational_algorithm" title="sympy.series.formal.rational_algorithm"><code class="xref py py-func docutils literal notranslate"><span class="pre">rational_algorithm()</span></code></a> uses <a class="reference internal" href="../polys/reference.html#sympy.polys.partfrac.apart" title="sympy.polys.partfrac.apart"><code class="xref py py-func docutils literal notranslate"><span class="pre">apart()</span></code></a> function for partial fraction
decomposition. <a class="reference internal" href="../polys/reference.html#sympy.polys.partfrac.apart" title="sympy.polys.partfrac.apart"><code class="xref py py-func docutils literal notranslate"><span class="pre">apart()</span></code></a> by default uses ‘undetermined coefficients
method’. By setting <code class="docutils literal notranslate"><span class="pre">full=True</span></code>, ‘Bronstein’s algorithm’ can be used
instead.</p>
<p>Looks for derivative of a function up to 4’th order (by default).
This can be overridden using order option.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">log</span><span class="p">,</span> <span class="n">atan</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.series.formal</span> <span class="kn">import</span> <span class="n">rational_algorithm</span> <span class="k">as</span> <span class="n">ra</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">k</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">ra</span><span class="p">(</span><span class="mi">1</span> <span class="o">/</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span>
<span class="go">(1, 0, 0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ra</span><span class="p">(</span><span class="n">log</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span>
<span class="go">(-1/((-1)**k*k), 0, 1)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">ra</span><span class="p">(</span><span class="n">atan</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">full</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="go">((-I/(2*(-I)**k) + I/(2*I**k))/k, 0, 1)</span>
</pre></div>
</div>
<p class="rubric">Notes</p>
<p>By setting <code class="docutils literal notranslate"><span class="pre">full=True</span></code>, range of admissible functions to be solved using
<code class="docutils literal notranslate"><span class="pre">rational_algorithm</span></code> can be increased. This option should be used
carefully as it can significantly slow down the computation as <code class="docutils literal notranslate"><span class="pre">doit</span></code> is
performed on the <a class="reference internal" href="../polys/reference.html#sympy.polys.rootoftools.RootSum" title="sympy.polys.rootoftools.RootSum"><code class="xref py py-class docutils literal notranslate"><span class="pre">RootSum</span></code></a> object returned by the <a class="reference internal" href="../polys/reference.html#sympy.polys.partfrac.apart" title="sympy.polys.partfrac.apart"><code class="xref py py-func docutils literal notranslate"><span class="pre">apart()</span></code></a>
function. Use <code class="docutils literal notranslate"><span class="pre">full=False</span></code> whenever possible.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../polys/reference.html#sympy.polys.partfrac.apart" title="sympy.polys.partfrac.apart"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.polys.partfrac.apart</span></code></a></p>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r677"><span class="brackets"><a class="fn-backref" href="#id3">R677</a></span></dt>
<dd><p>Formal Power Series - Dominik Gruntz, Wolfram Koepf</p>
</dd>
<dt class="label" id="r678"><span class="brackets"><a class="fn-backref" href="#id4">R678</a></span></dt>
<dd><p>Power Series in Computer Algebra - Wolfram Koepf</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="hypergeometric-algorithm">
<h2>Hypergeometric Algorithm<a class="headerlink" href="#hypergeometric-algorithm" title="Permalink to this headline">¶</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="sympy.series.formal.simpleDE">
<span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">simpleDE</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">f</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">g</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">order</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L202-L244"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.simpleDE" title="Permalink to this definition">¶</a></dt>
<dd><p>Generates simple DE.</p>
<p class="rubric">Explanation</p>
<p>DE is of the form</p>
<div class="math notranslate nohighlight">
\[f^k(x) + \sum\limits_{j=0}^{k-1} A_j f^j(x) = 0\]</div>
<p>where <span class="math notranslate nohighlight">\(A_j\)</span> should be rational function in x.</p>
<p>Generates DE’s upto order 4 (default). DE’s can also have free parameters.</p>
<p>By increasing order, higher order DE’s can be found.</p>
<p>Yields a tuple of (DE, order).</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.series.formal.exp_re">
<span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">exp_re</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">DE</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">r</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">k</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L247-L294"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.exp_re" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts a DE with constant coefficients (explike) into a RE.</p>
<p class="rubric">Explanation</p>
<p>Performs the substitution:</p>
<div class="math notranslate nohighlight">
\[f^j(x) \to r(k + j)\]</div>
<p>Normalises the terms so that lowest order of a term is always r(k).</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Function</span><span class="p">,</span> <span class="n">Derivative</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.series.formal</span> <span class="kn">import</span> <span class="n">exp_re</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">k</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="p">,</span> <span class="n">r</span> <span class="o">=</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;f&#39;</span><span class="p">),</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;r&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">exp_re</span><span class="p">(</span><span class="o">-</span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="n">Derivative</span><span class="p">(</span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">)),</span> <span class="n">r</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span>
<span class="go">-r(k) + r(k + 1)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">exp_re</span><span class="p">(</span><span class="n">Derivative</span><span class="p">(</span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="n">Derivative</span><span class="p">(</span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="mi">2</span><span class="p">)),</span> <span class="n">r</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span>
<span class="go">r(k) + r(k + 1)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.series.formal.hyper_re" title="sympy.series.formal.hyper_re"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.hyper_re</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.series.formal.hyper_re">
<span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">hyper_re</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">DE</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">r</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">k</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L297-L350"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.hyper_re" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts a DE into a RE.</p>
<p class="rubric">Explanation</p>
<p>Performs the substitution:</p>
<div class="math notranslate nohighlight">
\[x^l f^j(x) \to (k + 1 - l)_j . a_{k + j - l}\]</div>
<p>Normalises the terms so that lowest order of a term is always r(k).</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Function</span><span class="p">,</span> <span class="n">Derivative</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.series.formal</span> <span class="kn">import</span> <span class="n">hyper_re</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">k</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="p">,</span> <span class="n">r</span> <span class="o">=</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;f&#39;</span><span class="p">),</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;r&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">hyper_re</span><span class="p">(</span><span class="o">-</span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="n">Derivative</span><span class="p">(</span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">)),</span> <span class="n">r</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span>
<span class="go">(k + 1)*r(k + 1) - r(k)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">hyper_re</span><span class="p">(</span><span class="o">-</span><span class="n">x</span><span class="o">*</span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="n">Derivative</span><span class="p">(</span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="mi">2</span><span class="p">)),</span> <span class="n">r</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span>
<span class="go">(k + 2)*(k + 3)*r(k + 3) - r(k)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.series.formal.exp_re" title="sympy.series.formal.exp_re"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.exp_re</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.series.formal.rsolve_hypergeometric">
<span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">rsolve_hypergeometric</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">f</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">P</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">Q</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">k</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">m</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L490-L578"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.rsolve_hypergeometric" title="Permalink to this definition">¶</a></dt>
<dd><p>Solves RE of hypergeometric type.</p>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>formula</strong> : Expr</p>
<p><strong>ind</strong> : Expr</p>
<blockquote>
<div><p>Independent terms.</p>
</div></blockquote>
<p><strong>order</strong> : int</p>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>Attempts to solve RE of the form</p>
<p>Q(k)*a(k + m) - P(k)*a(k)</p>
<p>Transformations that preserve Hypergeometric type:</p>
<blockquote>
<div><ol class="loweralpha simple">
<li><p>x**n*f(x): b(k + m) = R(k - n)*b(k)</p></li>
<li><p>f(A*x): b(k + m) = A**m*R(k)*b(k)</p></li>
<li><p>f(x**n): b(k + n*m) = R(k/n)*b(k)</p></li>
<li><p>f(x**(1/m)): b(k + 1) = R(k*m)*b(k)</p></li>
<li><p>f’(x): b(k + m) = ((k + m + 1)/(k + 1))*R(k + 1)*b(k)</p></li>
</ol>
</div></blockquote>
<p>Some of these transformations have been used to solve the RE.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">ln</span><span class="p">,</span> <span class="n">S</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.series.formal</span> <span class="kn">import</span> <span class="n">rsolve_hypergeometric</span> <span class="k">as</span> <span class="n">rh</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">k</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">rh</span><span class="p">(</span><span class="n">exp</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="o">-</span><span class="n">S</span><span class="o">.</span><span class="n">One</span><span class="p">,</span> <span class="p">(</span><span class="n">k</span> <span class="o">+</span> <span class="mi">1</span><span class="p">),</span> <span class="n">k</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="go">(Piecewise((1/factorial(k), Eq(Mod(k, 1), 0)), (0, True)), 1, 1)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">rh</span><span class="p">(</span><span class="n">ln</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span> <span class="n">k</span><span class="o">*</span><span class="p">(</span><span class="n">k</span> <span class="o">+</span> <span class="mi">1</span><span class="p">),</span> <span class="n">k</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="go">(Piecewise(((-1)**(k - 1)*factorial(k - 1)/RisingFactorial(2, k - 1),</span>
<span class="go"> Eq(Mod(k, 1), 0)), (0, True)), x, 2)</span>
</pre></div>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r679"><span class="brackets"><a class="fn-backref" href="#id5">R679</a></span></dt>
<dd><p>Formal Power Series - Dominik Gruntz, Wolfram Koepf</p>
</dd>
<dt class="label" id="r680"><span class="brackets"><a class="fn-backref" href="#id6">R680</a></span></dt>
<dd><p>Power Series in Computer Algebra - Wolfram Koepf</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.series.formal.solve_de">
<span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">solve_de</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">f</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">DE</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">order</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">g</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">k</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L687-L740"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.solve_de" title="Permalink to this definition">¶</a></dt>
<dd><p>Solves the DE.</p>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>formula</strong> : Expr</p>
<p><strong>ind</strong> : Expr</p>
<blockquote>
<div><p>Independent terms.</p>
</div></blockquote>
<p><strong>order</strong> : int</p>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>Tries to solve DE by either converting into a RE containing two terms or
converting into a DE having constant coefficients.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Derivative</span> <span class="k">as</span> <span class="n">D</span><span class="p">,</span> <span class="n">Function</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">ln</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.series.formal</span> <span class="kn">import</span> <span class="n">solve_de</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">k</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span> <span class="o">=</span> <span class="n">Function</span><span class="p">(</span><span class="s1">&#39;f&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">solve_de</span><span class="p">(</span><span class="n">exp</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="n">D</span><span class="p">(</span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="p">)</span> <span class="o">-</span> <span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">f</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span>
<span class="go">(Piecewise((1/factorial(k), Eq(Mod(k, 1), 0)), (0, True)), 1, 1)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">solve_de</span><span class="p">(</span><span class="n">ln</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="n">D</span><span class="p">(</span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="o">+</span> <span class="n">D</span><span class="p">(</span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">)),</span> <span class="mi">2</span><span class="p">,</span> <span class="n">f</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span>
<span class="go">(Piecewise(((-1)**(k - 1)*factorial(k - 1)/RisingFactorial(2, k - 1),</span>
<span class="go"> Eq(Mod(k, 1), 0)), (0, True)), x, 2)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.series.formal.hyper_algorithm">
<span class="sig-prename descclassname"><span class="pre">sympy.series.formal.</span></span><span class="sig-name descname"><span class="pre">hyper_algorithm</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">f</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">k</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">order</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/series/formal.py#L743-L793"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.series.formal.hyper_algorithm" title="Permalink to this definition">¶</a></dt>
<dd><p>Hypergeometric algorithm for computing Formal Power Series.</p>
<p class="rubric">Explanation</p>
<dl class="simple">
<dt>Steps:</dt><dd><ul class="simple">
<li><p>Generates DE</p></li>
<li><p>Convert the DE into RE</p></li>
<li><p>Solves the RE</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">ln</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.series.formal</span> <span class="kn">import</span> <span class="n">hyper_algorithm</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span><span class="p">,</span> <span class="n">k</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">hyper_algorithm</span><span class="p">(</span><span class="n">exp</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span>
<span class="go">(Piecewise((1/factorial(k), Eq(Mod(k, 1), 0)), (0, True)), 1, 1)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">hyper_algorithm</span><span class="p">(</span><span class="n">ln</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">x</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span>
<span class="go">(Piecewise(((-1)**(k - 1)*factorial(k - 1)/RisingFactorial(2, k - 1),</span>
<span class="go"> Eq(Mod(k, 1), 0)), (0, True)), x, 2)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.series.formal.simpleDE" title="sympy.series.formal.simpleDE"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.simpleDE</span></code></a>, <a class="reference internal" href="#sympy.series.formal.solve_de" title="sympy.series.formal.solve_de"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.series.formal.solve_de</span></code></a></p>
</div>
</dd></dl>

</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h3><a href="../../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Formal Power Series</a><ul>
<li><a class="reference internal" href="#rational-algorithm">Rational Algorithm</a></li>
<li><a class="reference internal" href="#hypergeometric-algorithm">Hypergeometric Algorithm</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="fourier.html"
                        title="previous chapter">Fourier Series</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="limitseq.html"
                        title="next chapter">Limits of Sequences</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/modules/series/formal.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="limitseq.html" title="Limits of Sequences"
             >next</a> |</li>
        <li class="right" >
          <a href="fourier.html" title="Fourier Series"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" >Series</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Formal Power Series</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/series/formal.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:29:11 GMT -->
</html>